#ifndef __FDATE_H_
#define __FDATE_H_

#include "ftypes.h"


/* 这个文件中定义了与日期相关的太阳历和农历中要用到的
 * 各种数据源
 */


/* 平年的每个月的天数
 */
static const U8 sunMonthDays[12]={
	31,28,31,30,31,30,
	31,31,30,31,30,31
};

/* 公历每月1号前面的天数(平年)
 */
static const U16 sunMonthDayOffset[12]={0,31,59,90,120,151,181,212,243,273,304,334};

/* 星座名 */
static const char* starName[12] = {
	"魔羯座", /*12月22日 -1月20日 */ 
	"水瓶座", /*1月21日 - 2月19日 */
	"双鱼座", /*2月20日 - 3月20日 */
	"白羊座", /*3月21日 - 4月20日 */
	"金牛座", /*4月21日 - 5月21日 */
	"双子座", /*5月22日 - 6月21日 */
	"巨蟹座", /*6月22日 - 7月22日 */
	"狮子座", /*7月23日 - 8月23日 */
	"处女座", /*8月24日 - 9月23日 */
	"天秤座", /*9月24日 - 10月23日 */
	"天蝎座", /*10月24日 -11月22日 */
	"射手座"  /*11月23日 -12月21日 */
};

/* 以12-22号做一年的长度取余，来分割各个星座的偏移天数
 * [isLeapYear][n]
 */
static const U16 starEndOffsetDays[2][12] = {
	{20, 50, 79, 110, 141, 172, 203, 235, 266, 296, 326, 355 },
	{20, 50, 80, 111, 142, 173, 204, 236, 267, 297, 327, 356 }
};

/*星期名
*/
static const char* sunWeekName[7]={
	"日","一","二","三","四","五","六"
};
/* 默认的农历中文月份名称
 */
static const char* lunarMonthName[12]={
	"腊","正","二","三",
	"四","五","六","七",
	"八","九","十","冬"
};

/* 农历月份中每天的基本名称
 */
static const char* lunarDayName[30]={
	"三十","初一","初二","初三","初四","初五","初六","初七","初八","初九",
	"初十","十一","十二","十三","十四","十五","十六","十七","十八","十九",
	"二十","廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九"
};

/*天干
 */
static const char* nature[10]={
	"癸","甲","乙","丙","丁","戊","己","庚","辛","壬"
};

/*地支
 */
static const char* earth[12]={
	"亥","子","丑","寅","卯","辰","巳","午","未","申","酉","戌"
};

/* 属相名
 */
static const char* animal[12]={
	"猪","鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗"
};

/*节气
 */
static const char* solarTerm[12][2]={
	"大雪","冬至","小寒","大寒","立春","雨水",
	"惊蛰","春分","清明","谷雨","立夏","小满",
	"芒种","夏至","小暑","大暑","立秋","处暑",
	"白露","秋分","寒露","霜降","立冬","小雪"
};
/* 计算节气中的寿星公式中的常量C
 * [0][0-11][0-1]表示20世纪的常量
 * [1][0-11][0-1]表示21世纪的常量
 * 0-11表示了月份12-1-11
 * 0-1则表示了是某一个月中的那两个节气
 * 都是从大雪开始的
 */
static const float C[2][12][2]={
	7.9,22.6,6.11,20.84,4.6295,19.4599,6.3826,21.4155,5.59,20.888,6.318,21.86,
	6.5,22.2,7.928,23.65,8.35,23.95,8.44,23.822,9.098,24.218,8.218,23.08,//20世纪的
	7.18,21.94,5.4055,20.12,3.87,18.73,5.63,20.646,4.81,20.1,5.52,21.04,
	5.678,21.37,7.108,22.83,7.5,23.13,7.646,23.042,8.318,23.438,7.438,22.36//21世纪的
};

/* 农历数据记录从1900年到2099年每年的正月初一的公历日期、闰月和大小月分配
 * 数据说明：例如1900年的数据“0x1319296D”，第一位1是正月的公历月份，第二
 * 位和第三位的组合31是正月的公历日期，第四位9是闰月的所在月（即闰八月，
 * 如果是0则表示没有闰月），最后四位296D表示指定农历年的大小月排列（十六进
 * 制转二进制，转成二进制后，第一个数字1作为分隔符，在后面的数字中，0表示
 * 小月，1表示大月）
 */
static const U32 lunarData[]={
	0x1319296D, 0x219014AE, 0x20801A57, 0x12962A4D, 0x21601D26, 0x20401D95, 0x12552D55, 0x2130156A, 0x202019AD, 0x1223295D, //1900-1909
	0x210014AE, 0x1307349B, 0x21801A4D, 0x20601D25, 0x12663AA5, 0x21401B54, 0x20301D6A, 0x123332DA, 0x2110195B, 0x20182937, //1910-1919
	0x22001497, 0x20801A4B, 0x1286364B, 0x216016A5, 0x205016D4, 0x124535B5, 0x213012B6, 0x20201957, 0x1233292F, 0x21001497, //1920-1929
	0x13072C96, 0x21701D4A, 0x20601EA5, 0x12662DA9, 0x214015AD, 0x204012B6, 0x1244326E, 0x2110192E, 0x1318392D, 0x21901C95, //1930-1939
	0x20801D4A, 0x12773B4A, 0x21501B55, 0x2050156A, 0x1255355B, 0x2130125D, 0x2020192D, 0x1223392B, 0x21001A95, 0x12983695, //1940-1949
	0x217016CA, 0x20601B55, 0x12762AB5, 0x214014DA, 0x20301A5B, 0x12442A57, 0x2120152B, 0x1319352A, 0x21801E95, 0x208016AA, //1950-1959
	0x128735AA, 0x21501AB5, 0x205014B6, 0x125534AE, 0x21301A57, 0x20201526, 0x12143D26, 0x20901D95, 0x13082B55, 0x2170156A, //1960-1969
	0x2060196D, 0x1276295D, 0x215014AD, 0x20301A4D, 0x12353A4D, 0x21101D25, 0x13193AA5, 0x21801B54, 0x20701B6A, 0x128732DA, //1970-1979
	0x2160195B, 0x2050149B, 0x12553497, 0x21301A4B, 0x202B364B, 0x220016A5, 0x209016D4, 0x129735B4, 0x21701AB6, 0x20601957, //1980-1989
	0x1276292F, 0x21501497, 0x2040164B, 0x12342D4A, 0x21001EA5, 0x13192D65, 0x219015AC, 0x20701AB6, 0x1286326D, 0x2160192E, //1990-1999
	0x20501C96, 0x12453A95, 0x21201D4A, 0x20101DA5, 0x12232B55, 0x2090156A, 0x1298355B, 0x2180125D, 0x2070192D, 0x1266392B, //2000-2009
	0x21401A95, 0x20301B4A, 0x123536AA, 0x21001AD5, 0x131A2AB5, 0x219014BA, 0x20801A5B, 0x12872A57, 0x2160152B, 0x20501A93, //2010-2019
	0x12552E95, 0x212016AA, 0x20101AD5, 0x122329B5, 0x210014B6, 0x129734AE, 0x21701A4E, 0x20601D26, 0x12663D26, 0x21301D53, //2020-2029
	0x203015AA, 0x12342D6A, 0x2110196D, 0x131C295D, 0x219014AD, 0x20801A4D, 0x12873A4B, 0x21501D25, 0x20401D52, 0x12463B54, //2030-2039
	0x21201B5A, 0x2010156D, 0x1223295B, 0x2100149B, 0x13083497, 0x21701A4B, 0x20601AA5, 0x126636A5, 0x214016D2, 0x20201ADA, //2040-2049
	0x12342AB6, 0x21101937, 0x2019292F, 0x21901497, 0x2080164B, 0x12872D4A, 0x21501EA5, 0x204016B2, 0x1245356C, 0x21201AAE, //2050-2059
	0x2020192E, 0x1214392E, 0x20901C96, 0x12983A95, 0x21701D4A, 0x20501DA5, 0x12662B55, 0x2140156A, 0x20301A6D, 0x12352A5D, //2060-2069
	0x2110152D, 0x1319352B, 0x21901A95, 0x20701B4A, 0x127736AA, 0x21501AD5, 0x2050155A, 0x124534BA, 0x21201A5B, 0x2020152B, //2070-2079
	0x12243527, 0x20901693, 0x12982E53, 0x217016AA, 0x20601AD5, 0x126629B5, 0x214014B6, 0x20301A57, 0x12452A4E, 0x21001D26, //2080-2089
	0x13093D26, 0x21801D52, 0x20701DAA, 0x12772D6A, 0x2150156D, 0x205014AE, 0x1255349D, 0x21201A4D, 0x20101D15, 0x12133B25, //2090-2099
};

#endif //__FDATE_H_
